<!DOCTYPE html>
<html>

	<head>
		<title>我的消息</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
		<script src="/js/jquery/jquery.min.js"></script>
		<script src="/js/bootstrap/js/bootstrap.min.js"></script>
		<link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
		<link rel="stylesheet" href="/css/reset.css" />
		<link rel="stylesheet" href="/css/message.css" />
		<script src="/js/plugins/jrender/jrender.min.js"></script>
		<script>
			$(function () {
                //先接收共享过来的用户数据
                var userStr = sessionStorage.getItem("user")
                var user = JSON.parse(userStr);
			    //查询系统消息
			    $.get("/messages/getSysMsg/1",function (data) {
                    console.log(data);
                    $("#sysMsg").renderValues({list:data.list})
                })
				var state=1;
				$("#system").click(function () {
				    if (state==1){
				        $("#sysBtn").attr("class","fa fa-chevron-down")
					$("#sysMsg").attr("hidden",false)
						state++;
					}else {
                        $("#sysMsg").attr("hidden",true)
                        $("#sysBtn").attr("class","fa fa-chevron-right")
						state=1;
					}
                })
				//查询未读私信数量
				$.get("/messages/getPriMsgNum",{userId:user.id,hasRead:0},function (data) {
                    console.log(data);
                    $("#msgRead").html(data)
                    if ($("#msgRead").html() == 0) {
                        $("#msgRead").remove()
                    }else{
                        $("#msgClass").addClass("fa-spin")
                    }
                })
				//查询未读评论我的数量
                $.get("/strategyComments/getCountHasReadSub/"+user.id,function (data) {
                    console.log(data);
                    $("#commentMe").html(data)
                    if ($("#commentMe").html() == 0) {
                        $("#commentMe").remove()
                    }else{
							$("#commentClass").addClass("fa-spin")
					}
                })
                //查询未读赞我的数量
                $.get("/users/"+user.id+"/getNoReadLike",function (data) {
                    console.log(data);
                    $("#likeMe").html(data)
                    if ($("#likeMe").html() == 0) {
                        $("#likeMe").remove()
                    }else{
                        $("#likeClass").addClass("fa-spin")
                    }
                })

                //查询未读@我的数量
                $.get("/strategyComments/noReadMentions",function (data) {
                    console.log(data);
                    $("#mentions").html(data)
                    if ($("#mentions").html() == 0) {
                        $("#mentions").remove()
                    }else{
                        $("#mentionsClass").addClass("fa-spin")
                    }
                })

            })
		</script>
	</head>

	<body>
		<div class="search-head">
			<div class="row nav-search">
				<div class="col">
					<a href="/index.html">
						<span><i class="fa fa-chevron-left" ></i></span>
					</a>
				</div>
				<div class="col">
					<span>我的消息</span>
				</div>
				<div class="col"></div>
			</div>
		</div>

		<ul class="list-group">
			<a href="/mine/like.html">
				<li class="list-group-item d-flex justify-content-between align-items-center">
					<div class="item">
						<span><i id="likeClass" class="fa fa-thumbs-o-up" ></i></span>
						<span>赞我的</span>
						<span id="likeMe" class="badge badge-danger badge-pill"></span>
					</div>
					<i class="fa fa-chevron-right"></i>
				</li>
			</a>
			<a href="/mine/mentions.html">
				<li class="list-group-item d-flex justify-content-between align-items-center">
					<div class="item">
						<span><i id="mentionsClass" class="fa fa-at fa-fw"></i></span>
						<span>@我的</span>
						<span id="mentions" class="badge badge-danger badge-pill"></span>
					</div>
					<i class="fa fa-chevron-right"></i>
				</li>
			</a>
			<a href="/mine/comment.html">
				<li class="list-group-item d-flex justify-content-between align-items-center">
					<div class="item">
						<span><i id="commentClass" class="fa fa-commenting-o"></i>	</span>
						<span>评论我的</span>
						<span id="commentMe" class="badge badge-danger badge-pill"></span>
					</div>
					<i class="fa fa-chevron-right"></i>
				</li>
			</a>
			<a href="/mine/privateLetter.html">
				<li class="list-group-item d-flex justify-content-between align-items-center">
					<div class="item">
						<span><i id="msgClass" class="fa fa-envelope-o" ></i></span>
						<span>	私信</span>
						<span id="msgRead" class="badge badge-danger badge-pill"></span>
					</div>
					<i class="fa fa-chevron-right"></i>
				</li>
			</a>
			<a href="javascript:;" id="system">
				<li class="list-group-item d-flex justify-content-between align-items-center">
					<div class="item">
						<span><i class="fa fa-bell" ></i></span>
						<span>系统通知</span>

					</div>
					<i id="sysBtn" class="fa fa-chevron-right"></i>
				</li>
			</a>
		</ul>

		<div class="container systemMsg" id="sysMsg" hidden >
			<dl class="itemList" render-loop="list">
				<div class="comment">
					<dd>
						<p style="color: red;font-size: 25px" render-html="list.title"></p>
						<p style="font-size: 20px" render-html="list.content"></p>
						<span class="comment-date" render-html="list.creatTime"></span>
					</dd>
				</div>
			</dl>
		</div>

	</body>

</html>